package com.dcits.filter.sensitive;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.Map;

@Data
@Configuration
@ConfigurationProperties(prefix = "logging.sensitive")
@NoArgsConstructor
public class SensitiveDataConfig {
    public static final String SENSITIVE_DATA_KEY = "SensitiveData";
    private Map<String, String> rules;

    @PostConstruct
    public void initRules() {
        System.setProperty(SENSITIVE_DATA_KEY, JSON.toJSONString(rules));
    }

}